/**
 * @file        done.hpp
 * @brief       Defines done items abstraction.
 *
 * @author      Emre Turkay <emreturkay at gmail>
 * @date        Nov.2.2008
 *
 * Copyright Emre Turkay 2009
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file COPYRIGHT or copy at
 * http://www.boost.org/LICENSE_1_0.txt)
 */

#ifndef _GTD_DONE_HPP_
#define _GTD_DONE_HPP_

#include <boost/date_time/posix_time/posix_time.hpp>

#include <string>

namespace gtd
{

    /// Represents one done item.
    struct done_item
    {
        /// Default constructor.
        done_item();

        /// Initializes a done item with the current date-time.
        done_item(const std::string& l);

        /// Initializes a done item with the given date-time.
        done_item(boost::posix_time::ptime t, const std::string& line);

        /// Compare done items according to their timestamps.
        bool operator<(const done_item& i) const;

        /// Writes a done item into an ostream.
        void write(std::ostream& os) const;

        /// Reads a done item from an istream.
        void read(std::istream& is);

        /// Returns the timestamp.
        const boost::posix_time::ptime& time() const;

        /// Returns the action string.
        const std::string& line() const;

    private:
        /// The timestamp.
        boost::posix_time::ptime time_;
        /// The action string.
        std::string line_;
    };

} // namespace gtd

#include "done.ipp"

#endif // _GTD_DONE_HPP_
